package com.extremelylargepackage.entity;

import com.extremelylargepackage.GameResources;

public class AiSeeker implements AiMoveComponent
{
	private Enemy _me;
	private int _timeSinceDirectionChanged;
	private float _minTimeBetweenMoves;
	
	public AiSeeker(float delay)
	{
		_minTimeBetweenMoves = delay;
	}
	
	@Override
	public void performMove(long time) 
	{
		_timeSinceDirectionChanged += time;
		if(_timeSinceDirectionChanged >= _minTimeBetweenMoves)
		{
			_me._dirX = _me._player._locX - _me._locX;
			_timeSinceDirectionChanged = 0;
			float newPointY = (float)(Math.random() * ((float)GameResources.SCREEN_HEIGHT) * .75);
			_me._dirY = newPointY - _me._locY;
		}
	}

	@Override
	public void setSelf(Enemy me) 
	{
		_me = me;
	}
	
	public Object clone()
	{
		return new AiSeeker(_minTimeBetweenMoves);
	}

	@Override
	public boolean finished() {
		// TODO Auto-generated method stub
		return false;
	}

}
